public class 盛最多水的容器 {
    //https://leetcode.cn/problems/container-with-most-water/description/
    //双指针
    public int maxArea(int[] height) {
        int left = 0;
        int right = height.length - 1;
        int ans = 0;
        while(left < right){
            //如果短的木板不进行移动, 那不管怎么样都不会有提升
            if(height[left] < height[right]){
                ans = Math.max(ans,(right - left) * height[left]);
                left++;
            }else{
                ans = Math.max(ans,(right - left) * height[right]);
                right--;
            }
        }
        return ans;
    }
}
